#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Expression.h"
#include "TemplateableElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {

/// <summary>
/// StringExpression
/// A StringExpression is an Expression that specifies a String value that is
/// derived by concatenating a sequence of operands with String values or a sequence
/// of subExpressions, some of which might be template parameters.
/// </summary>
class UMLMODEL_EXPORT StringExpression : public Expression, public TemplateableElement {

public: // Constructors and destructors
    explicit StringExpression(const QString& umlType="uml::StringExpression");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// stringValue
    /// The query stringValue() returns the String resulting from concatenating, in
    /// order, all the component String values of all the operands or subExpressions
    /// that are part of the StringExpression.
    /// </summary>
    QString stringValue() const override;

public: // Properties
    /// <summary>
    /// owningExpression getter
    /// The StringExpression of which this StringExpression is a subExpression.
    /// </summary>
    shared_ptr<StringExpression> owningExpression() const;

    /// <summary>
    /// owningExpression setter
    /// The StringExpression of which this StringExpression is a subExpression.
    /// </summary>
    void setOwningExpression(shared_ptr<StringExpression> value);

    /// <summary>
    /// subExpressions getter
    /// The StringExpressions that constitute this StringExpression.
    /// </summary>
    vector<shared_ptr<StringExpression>>& subExpressions();

private: // Fields
    /// <summary>
    /// owningExpression
    /// The StringExpression of which this StringExpression is a subExpression.
    /// </summary>
    shared_ptr<StringExpression> owningExpression_;

    /// <summary>
    /// subExpressions
    /// The StringExpressions that constitute this StringExpression.
    /// </summary>
    vector<shared_ptr<StringExpression>> subExpressions_;

};

} // namespace uml
